import { Tabs, Toast, List, InputItem, } from '@ant-design/react-native';

const phone = /^[1][3,4,5,7,8][0-9]{9}$/;

export const validate = (value, required, regExp, message) => {
    if (!value) {
        Toast.info(message.required, 1);
        return false
    }
    if (!regExp.test(value)) {
        Toast.info(message.error, 1);
        return false
    }
    return true
}

export const required = (value, message) => {
    if (!value) {
        Toast.info(message.required, 1);
        return false
    }
    return true
}

export const isPhone = (value, required) => {
    return validate(value, required, phone, {
        required: '请输入手机号',
        error: '手机号格式错误'
    })
}
